/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
  color: #333;
}

/* 应用布局 */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 导航栏 */
.navbar {
  background-color: #2c3e50;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.nav-logo {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-menu a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.nav-menu a:hover {
  background-color: rgba(255,255,255,0.1);
}

/* 主内容区域 */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* 页面标题 */
.demo-page h1 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

.description {
  color: #666;
  margin-bottom: 2rem;
  font-size: 1.2rem;
}

/* 演示区块 */
.demo-section {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.demo-section h2 {
  color: #34495e;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.5rem;
}

/* 按钮样式 */
.button-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

button:hover:not(:disabled) {
  background-color: #2980b9;
}

button:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
}

/* 输入框样式 */
input, select {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  margin: 0.25rem;
}

input:focus, select:focus {
  outline: none;
  border-color: #3498db;
}

/* 首页样式 */
.home-page {
  text-align: center;
}

.hero-section {
  margin-bottom: 3rem;
}

.hero-section h1 {
  font-size: 3rem;
  color: #2c3e50;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 1.5rem;
  color: #7f8c8d;
  margin-bottom: 2rem;
}

.hooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.hook-card {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.hook-card:hover {
  transform: translateY(-5px);
}

.hook-card h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.hook-card p {
  color: #666;
  margin-bottom: 1.5rem;
}

.demo-link {
  display: inline-block;
  background-color: #3498db;
  color: white;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.demo-link:hover {
  background-color: #2980b9;
}

/* 计数器样式 */
.counter-demo {
  text-align: center;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.counter-demo p {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

/* 表单样式 */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.user-display {
  margin-top: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 4px;
}

/* 待办事项样式 */
.todo-demo {
  max-width: 500px;
}

.todo-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.todo-input input {
  flex: 1;
}

.todo-list {
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  background: white;
}

.remove-btn {
  background-color: #e74c3c;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.empty-message {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
}

/* 数据获取样式 */
.data-fetch-demo {
  max-width: 600px;
}

.user-selector {
  margin-bottom: 1rem;
}

.user-info {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
}

.user-info p {
  margin-bottom: 0.5rem;
}

.loading {
  text-align: center;
  color: #3498db;
  font-size: 1.2rem;
}

/* 主题切换样式 */
.theme-toggle {
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* 用户认证样式 */
.login-form {
  margin-bottom: 2rem;
}

.login-buttons {
  display: flex;
  gap: 1rem;
}

.user-profile {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.user-actions button {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

/* 待办事项应用样式 */
.todo-app {
  max-width: 600px;
}

.add-todo {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

.filter-buttons button {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.filter-buttons button.active {
  background-color: #2c3e50;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  background: white;
}

.todo-text {
  flex: 1;
}

.todo-text.completed {
  text-decoration: line-through;
  color: #7f8c8d;
}

.priority-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}

.clear-completed {
  background-color: #e74c3c;
  margin-top: 1rem;
}

.toggle-all {
  background-color: #95a5a6;
  margin-top: 1rem;
}

/* 代码示例样式 */
.code-example {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
}

.code-example h3 {
  color: #63b3ed;
  margin-bottom: 1rem;
}

.code-example pre {
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* 最佳实践样式 */
.best-practices {
  display: grid;
  gap: 2rem;
}

.practice-item {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
}

.practice-item h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.practice-item ul {
  list-style-position: inside;
  color: #555;
}

.practice-item li {
  margin-bottom: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-menu {
    justify-content: center;
  }

  .main-content {
    padding: 1rem;
  }

  .hooks-grid {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  .todo-input,
  .add-todo,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons {
    flex-direction: column;
  }
}

/* 特殊样式 */
.note {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  color: #856404;
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.comparison-item {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .comparison {
    grid-template-columns: 1fr;
  }
}

/* 历史记录样式 */
.history-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-list span {
  padding: 0.5rem;
  background: #e9ecef;
  border-radius: 4px;
  font-family: monospace;
}

.history-list .current {
  background: #007bff;
  color: white;
  font-weight: bold;
}
